#include <stdio.h>
#include <memory.h>
#include <cmath>
#include <algorithm>

using namespace std;

int slaisnan_(float *sin1, float *sin2) {    
    return ((*sin1) != (*sin2));
}

int sisnan_(float *f) {
    return slaisnan_(f, f);
}

double slapy2_(float *x, float *y) {	
	float w, z, xabs, yabs;

	xabs = abs(*x);
	yabs = abs(*y);
	w = max(xabs, yabs);
	z = min(xabs, yabs);
	if (z == 0.f) {
		return w;
	} else {		
		float f = z / w;
		return w * sqrt(f * f + 1.f);
	}
}

double r_sign(float *a, float *b) {
	double x;
	x = (*a >= 0 ? *a : - *a);
	return( *b >= 0 ? x : -x);
}
